home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / demos / OpenGL / ideas / o.c < prev    next >
C/C++ Source or Header  |  1996-11-11  |  5KB  |  152 lines

  1. /*
  2.  * (c) Copyright 1993, Silicon Graphics, Inc.
  3.  * ALL RIGHTS RESERVED 
  4.  * Permission to use, copy, modify, and distribute this software for 
  5.  * any purpose and without fee is hereby granted, provided that the above
  6.  * copyright notice appear in all copies and that both the copyright notice
  7.  * and this permission notice appear in supporting documentation, and that 
  8.  * the name of Silicon Graphics, Inc. not be used in advertising
  9.  * or publicity pertaining to distribution of the software without specific,
  10.  * written prior permission. 
  11.  *
  12.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  13.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  14.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  15.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  16.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  17.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  18.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  19.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  20.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  21.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  22.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  23.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  24.  * 
  25.  * US Government Users Restricted Rights 
  26.  * Use, duplication, or disclosure by the Government is subject to
  27.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  28.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  29.  * clause at DFARS 252.227-7013 and/or in similar or successor
  30.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  31.  * Unpublished-- rights reserved under the copyright laws of the
  32.  * United States.  Contractor/manufacturer is Silicon Graphics,
  33.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  34.  *
  35.  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  36.  */
  37. #include <GL/gl.h>
  38.  
  39. float o_data[][2] = {
  40.     {2.975610, 9.603255},
  41.     {2.878049, 9.342828},
  42.     {2.292683, 9.131231},
  43.     {2.048780, 8.691760},
  44.     {1.707317, 8.528993},
  45.     {1.658537, 7.731434},
  46.     {0.878049, 7.047813},
  47.     {1.349594, 5.550356},
  48.     {0.569106, 5.029501},
  49.     {1.528455, 4.443540},
  50.     {0.991870, 3.434385},
  51.     {1.967480, 3.955239},
  52.     {1.772358, 2.994914},
  53.     {2.422764, 3.825025},
  54.     {2.829268, 3.092574},
  55.     {3.154472, 3.971516},
  56.     {3.512195, 3.727365},
  57.     {3.772358, 4.264496},
  58.     {4.130081, 4.524924},
  59.     {4.162601, 4.996948},
  60.     {4.699187, 5.403866},
  61.     {4.471545, 6.461852},
  62.     {5.219512, 7.243133},
  63.     {4.439024, 8.105799},
  64.     {5.235772, 8.756866},
  65.     {4.065041, 8.870804},
  66.     {4.991870, 9.391658},
  67.     {3.853658, 9.228891},
  68.     {4.390244, 9.912513},
  69.     {3.463415, 9.407935},
  70.     {3.674797, 9.912513},
  71.     {2.829268, 9.342828},
  72.     {2.959350, 9.603255},
  73.  
  74. };
  75.  
  76. void draw_o(void) {
  77.  
  78.     glBegin(GL_TRIANGLE_STRIP);
  79.     glVertex2fv(o_data[0]);
  80.     glVertex2fv(o_data[1]);
  81.     glVertex2fv(o_data[2]);
  82.     glVertex2fv(o_data[3]);
  83.     glVertex2fv(o_data[4]);
  84.     glVertex2fv(o_data[5]);
  85.     glVertex2fv(o_data[6]);
  86.     glVertex2fv(o_data[7]);
  87.     glVertex2fv(o_data[8]);
  88.     glVertex2fv(o_data[9]);
  89.     glVertex2fv(o_data[10]);
  90.     glVertex2fv(o_data[11]);
  91.     glVertex2fv(o_data[12]);
  92.     glVertex2fv(o_data[13]);
  93.     glVertex2fv(o_data[14]);
  94.     glVertex2fv(o_data[15]);
  95.     glVertex2fv(o_data[16]);
  96.     glVertex2fv(o_data[17]);
  97.     glVertex2fv(o_data[18]);
  98.     glVertex2fv(o_data[19]);
  99.     glVertex2fv(o_data[20]);
  100.     glVertex2fv(o_data[21]);
  101.     glVertex2fv(o_data[22]);
  102.     glVertex2fv(o_data[23]);
  103.     glVertex2fv(o_data[24]);
  104.     glVertex2fv(o_data[25]);
  105.     glVertex2fv(o_data[26]);
  106.     glVertex2fv(o_data[27]);
  107.     glVertex2fv(o_data[28]);
  108.     glVertex2fv(o_data[29]);
  109.     glVertex2fv(o_data[30]);
  110.     glVertex2fv(o_data[31]);
  111.     glVertex2fv(o_data[32]);
  112.     glEnd();
  113.  
  114.     glBegin(GL_LINE_STRIP);
  115.     glVertex2fv(o_data[0]);
  116.     glVertex2fv(o_data[2]);
  117.     glVertex2fv(o_data[4]);
  118.     glVertex2fv(o_data[6]);
  119.     glVertex2fv(o_data[8]);
  120.     glVertex2fv(o_data[10]);
  121.     glVertex2fv(o_data[12]);
  122.     glVertex2fv(o_data[14]);
  123.     glVertex2fv(o_data[16]);
  124.     glVertex2fv(o_data[18]);
  125.     glVertex2fv(o_data[20]);
  126.     glVertex2fv(o_data[22]);
  127.     glVertex2fv(o_data[24]);
  128.     glVertex2fv(o_data[26]);
  129.     glVertex2fv(o_data[28]);
  130.     glVertex2fv(o_data[30]);
  131.     glVertex2fv(o_data[32]);
  132.     glVertex2fv(o_data[31]);
  133.     glVertex2fv(o_data[29]);
  134.     glVertex2fv(o_data[27]);
  135.     glVertex2fv(o_data[25]);
  136.     glVertex2fv(o_data[23]);
  137.     glVertex2fv(o_data[21]);
  138.     glVertex2fv(o_data[19]);
  139.     glVertex2fv(o_data[17]);
  140.     glVertex2fv(o_data[15]);
  141.     glVertex2fv(o_data[13]);
  142.     glVertex2fv(o_data[11]);
  143.     glVertex2fv(o_data[9]);
  144.     glVertex2fv(o_data[7]);
  145.     glVertex2fv(o_data[5]);
  146.     glVertex2fv(o_data[3]);
  147.     glVertex2fv(o_data[1]);
  148.     glEnd();
  149.  
  150. }
  151.  
  152.